package com.comment.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 * 
 * 
 * @author Wangpeihu
 * @team [Never give up]
 * @since JDK1.6(建议)
 * @date 2010-5-18
 */
public class HibernateUtils {
	private static Configuration conf;

	private static SessionFactory factory;
	static {
		conf = new Configuration();
		conf.configure();
		factory = conf.buildSessionFactory();
	}

	public static Session getSession() {
		return factory.openSession();
	}

	public static SessionFactory getSessionFactory() {
		return factory;
	}

	public static void main(String[] args) {
		Session session = HibernateUtils.getSession();
		System.out.println(session);
	}
}
